package com.cebbank.yyi.springbootapp.jingtang.service.impl;

import com.cebbank.yyi.springbootapp.jingtang.entity.RcDocAuthor;
import com.cebbank.yyi.springbootapp.jingtang.dao.RcDocAuthorDao;
import com.cebbank.yyi.springbootapp.jingtang.service.RcDocAuthorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 文档编制人(RcDocAuthor)表服务实现类
 *
 * @author makejava
 * @since 2024-08-22 10:34:43
 */
@Service("rcDocAuthorService")
public class RcDocAuthorServiceImpl implements RcDocAuthorService {
    @Resource
    private RcDocAuthorDao rcDocAuthorDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public RcDocAuthor queryById(String id) {
        return this.rcDocAuthorDao.queryById(id);
    }

//    /**
//     * 分页查询
//     *
//     * @param rcDocAuthor 筛选条件
//     * @param pageRequest 分页对象
//     * @return 查询结果
//     */
//    @Override
//    public Page<RcDocAuthor> queryByPage(RcDocAuthor rcDocAuthor, PageRequest pageRequest) {
//        long total = this.rcDocAuthorDao.count(rcDocAuthor);
//        return new PageImpl<>(this.rcDocAuthorDao.queryAllByLimit(rcDocAuthor, pageRequest), pageRequest, total);
//    }

    /**
     * 新增数据
     *
     * @param rcDocAuthor 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocAuthor insert(RcDocAuthor rcDocAuthor) {
        this.rcDocAuthorDao.insert(rcDocAuthor);
        return rcDocAuthor;
    }

    /**
     * 修改数据
     *
     * @param rcDocAuthor 实例对象
     * @return 实例对象
     */
    @Override
    public RcDocAuthor update(RcDocAuthor rcDocAuthor) {
        this.rcDocAuthorDao.update(rcDocAuthor);
        return this.queryById(rcDocAuthor.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.rcDocAuthorDao.deleteById(id) > 0;
    }
}
